package com.ruoyi.camp.api;

import com.ruoyi.camp.domain.CBanner;
import com.ruoyi.camp.service.ICBannerService;
import com.ruoyi.common.annotation.Anonymous;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.page.TableDataInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.Banner;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/wechat/banner")
public class WxBannerController extends BaseController {
    @Autowired
    private ICBannerService bannerService;
/*
    查询广告列表

*/
    @Anonymous
    @GetMapping("/list")
    public TableDataInfo list(CBanner banner){
        startPage();
        List<CBanner> list =bannerService.selectCBannerList(banner);
        return getDataTable(list);
    }


    @GetMapping(value = "/{bannerId}")
    public AjaxResult getInfo(@PathVariable("bannerId") String bannerId){
        return success(bannerService.selectCBannerByBannerId(bannerId));
    }

}
